<template>
	<ul class="zxyh-footer-ul">
		<li v-for="item of navData" class="tabItem" @click.native="linkLive" :class="{'router-link-active':myPath===item.url}">
			<template>
				<a href="javascript:void(0)" @click="goFullView(item.url)">
					<div :class='item.iconClass'></div>
					<p class=" nav-icon-title">{{ item.title}}</p>
				</a>
			</template>
		</li>
	</ul>
</template>
<script>
	import fun from "../../util/function";
	export default {
		data() {
			return {
				myPath: '', //路由地址 url
				navData: [{
						url: 'zxyhHome',
						iconClass: 'navIconPic_1',
						title: '首页',
						hasRouter: true,
					},
					{
						url: 'telChannel',
						iconClass: 'navIconPic_2',
						title: '频道',
						hasRouter: true,
					},
					{
						url: 'mine',
						iconClass: 'navIconPic_3',
						title: '我的',
						hasRouter: true
					}
				],
				bottom: true,
			}
		},
		created() {
			this.$store.dispatch("showNav")

		},
		mounted() {
			// 初始化页面navTab高亮显示
			this.myPath = this.$route.path.split('/')[2];
		},
		watch: {
			// 监听路由navTab高亮显示
			$route(to, from) {
				this.myPath = to.path.split('/')[2];
			}
		},
		props: {},
		computed: {
			sysInfo() {
				return this.$store.state.SysOrgInfo;
			}
		},
		methods: {
			linkLive() {
				this.$store.state.liveNavCur = 1;
			},
			goFullView(url) {
				if(this.$store.state.isYk && url == 'mine') { //游客
					let jointUrl = fun.getCurPageUrl('home')
					fun.ykDisposeFun(jointUrl);
					return
				}
				if(window.terminal.isZxyhApp && url == 'mine') { //zxyh 未登录 调起登录
					window.bank.userInfoPlugin.isLogin((res) => {
						//console.log('zxyh res.isLogin',res.isLogin)
						if(res.isLogin) { //  true 已经登录				 	
							this.$router.push(`/${this.$channel}/${url}`)
						} else { //  false  未登录
							fun.zxyhLogin(window.location.href) //调起登录	  		
						}
					})
				} else {
					this.$router.push(`/${this.$channel}/${url}`)
				}
				
			},
		}
	};
</script>
<style scoped="scoped">
	@keyframes keyNavBottom {
		0% {
			transform: scale(1);
		}
		25% {
			transform: scale(1.1);
		}
		50% {
			transform: scale(0.9);
		}
		75% {
			transform: scale(1.1);
		}
		100% {
			transform: scale(1);
		}
	}
	
	.zxyh-footer-ul {
		height: 100px;
		display: flex;
		display: -webkit-flex;
		justify-content: space-around;
		-webkit-justify-content: space-around;
		align-items: center;
	}
	
	.zxyh-footer-ul li {
		width: 19%;
		height: 100%;
	}
	
	.tabItem a {
		display: block;
		width: 100%;
	}
	
	.router-link-active p {
		color: #C2512F;
	}
	
	.tabItem div {
		margin: 0 auto;
	}
	
	.router-link-active .navIconPic_1 {
		width: 40px;
		height: 44px;
		background: url(../../assets/images/zxyh/zxyh-footer-sprite-icon.png) no-repeat;
		background-size: 417px 209px;
		background-position: -50px -114px;
		animation: keyNavBottom 0.3s ease-in;
	}
	
	.navIconPic_1 {
		width: 40px;
		height: 44px;
		background: url(../../assets/images/zxyh/zxyh-footer-sprite-icon.png) no-repeat;
		background-size: 417px 209px;
		background-position: -50px -28px;
	}
	
	.router-link-active .navIconPic_2 {
		width: 45px;
		height: 45px;
		background: url(../../assets/images/zxyh/zxyh-footer-sprite-icon.png) no-repeat;
		background-size: 417px 209px;
		background-position: -187px -113px;
		animation: keyNavBottom 0.3s ease-in;
	}
	
	.navIconPic_2 {
		width: 45px;
		height: 45px;
		background: url(../../assets/images/zxyh/zxyh-footer-sprite-icon.png) no-repeat;
		background-size: 417px 209px;
		background-position: -187px -29px;
	}
	
	.router-link-active .navIconPic_3 {
		width: 41px;
		height: 45px;
		background: url(../../assets/images/zxyh/zxyh-footer-sprite-icon.png) no-repeat;
		background-size: 417px 209px;
		background-position: -329px -113px;
		animation: keyNavBottom 0.3s ease-in;
	}
	
	.navIconPic_3 {
		width: 41px;
		height: 45px;
		background: url(../../assets/images/zxyh/zxyh-footer-sprite-icon.png) no-repeat;
		background-size: 417px 209px;
		background-position: -329px -28px;
	}
	
	.nav-icon-title {
		height: auto;
		color: #CCCCCCFF;
		font-size: 20px;
		text-align: center;
		margin-top: 5px;
	}
	/* 去掉img标签的默认灰色边框 */
	
	img[src=""],
	img:not([src]) {
		opacity: 0;
	}
</style>